package com.example.demo.netty;


import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;

public class SocketChannelHandler {

    public static void handleConnection (SocketChannel clientSocket) throws IOException {
        ByteBuffer buffer = ByteBuffer.allocate(1024);
        while (clientSocket.read(buffer) > 0) {
            // 处理读取的数据
            buffer.flip();
            // 假设处理数据逻辑...
            buffer.clear();
        }
    }
}
